﻿using BonjourQuotation.DataAccess.Repositories;
using BonjourQuotation.ObjectModel.AccountData;
using BonjourQuotation.ObjectModel.ErrorData;
using BonjourQuotation.ObjectModel.SeasonData;
using BonjourQuotation.ObjectModel.LoggerData;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace BonjourQuotation.UI.ServiceManagers
{
    public class SeasonManager
    {
        private readonly log4net.ILog logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
        public ErrorBInfo CreateSeason(ManageSeasonsGridRowBData SeasonData)
        {
            try
            {
                var proxy = new SeasonRepository();
                return proxy.CreateSeason(SeasonData);
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToMessageAndCompleteStacktrace());
                return null;
            } 
        }
        public ManageSeasonsGridBData LoadSeasons(int PageNumber)
        {
            try
            {
                var proxy = new SeasonRepository();
                return proxy.LoadSeasons(PageNumber);
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToMessageAndCompleteStacktrace());
                return null;
            } 
        }
        public ManageSeasonsGridBData LoadSearchedSeasons(ManageSeasonsGridBData Data)
        {
            try
            {
                var proxy = new SeasonRepository();
                return proxy.LoadSearchedSeasons(Data);
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToMessageAndCompleteStacktrace());
                return null;
            } 
        }
        public ErrorBInfo SaveSeasonDetailsData(ManageSeasonsGridBData Data)
        {
            try
            {
                var proxy = new SeasonRepository();
                return proxy.SaveSeasonDetailsData(Data);
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToMessageAndCompleteStacktrace());
                return null;
            } 
        }
    }
}